<template>
	<view>
		<view :class="item.clicked==1?'user-card-clicked':'user-card'" v-for="(item,index) in dataList"
			@click.stop="selected(index)">

			<view :class="item.clicked==1?'cover':'cover-unclick'">

				<!-- <image class="img" mode="aspectFit"
					:src="item.seriesImage||'@appstatic/img/my/appoint_img_small.png'" /> -->
					
					<image class="img" mode="aspectFit" v-if="item.seriesCode==1"
						src="@appstatic/car/gravitation_s.png" />
						
						<image class="img" mode="aspectFit" v-else-if="item.seriesCode==2"
							src="@appstatic/car/starShip_s.png" />
							
							<image class="img" mode="aspectFit" v-else
								:src="item.seriesImage||'@appstatic/img/my/appoint_img_small.png'" />
					
				<view class="info">
					<view :class="item.clicked==1?'type-clicked':'type'">{{item.seriesName}}</view>
					<view class="price" v-if="item.seriesPrice==null||item.seriesPrice==''">敬请期待</text></view>
					<view class="price" v-else>￥{{item.seriesPrice}}<text class="before"
							style="font-size: 12px;">起</text></view>
				</view>


			</view>
		</view>
		<view v-if="dataList.length==0">
			<view class='img-box'>
				<image class='emptyImage' src='@appstatic/img/my/my_order_no_data.png'></image>
				<view class='text'>暂无数据</view>
			</view>
		</view>


	</view>
</template>

<script>
	export default {
		name: "carSeries",
		props: {
			carSeriesList: {
				type: Array,
				default: () => {
					return []
				}
			}

		},
		data() {
			return {

			};
		},
		computed: {
			dataList: {
				get() {
					for (var i = 0; i < this.carSeriesList.length; i++) {
						if (this.carSeriesList[i].clicked == 1) {
							this.$emit('carSeriesItem_watch', this.carSeriesList[i])
						}
					}
					return this.carSeriesList
				},
				set(v) {

				}

			}
		},
		methods: {
			selected: function(index) {
				for (var i = 0; i < this.dataList.length; i++) {
					if (index == i) {
						this.dataList[i].clicked = 1
						this.$emit('carSeriesItem', this.dataList[i])

					} else {
						this.dataList[i].clicked = 0
					}

				}

			},
			setData(list) {
				this.dataList = list
			},

		}
	}
</script>

<style lang='scss' scoped>
	.user-card-clicked {
		width: calc(100% - 30px);
		margin-top: 20rpx;
		height: 100px;
		margin-left: 15px;
		clip-path: polygon(15px 0, calc(100% - 15px) 0,

				100% 0px, 100% calc(100% - 15px),

				calc(100% - 15px) 100%, 0px 100%,

				0 calc(100% - 15px), 0 15px);

		background: linear-gradient(-45deg, #EA5404 10px, #EDEDED 0) bottom right,

			linear-gradient(45deg, #EA5404 0px, #EDEDED 0) bottom left,

			linear-gradient(135deg, #EA5404 10px, #EDEDED 0) top left,

			linear-gradient(-135deg, #EA5404 0px, #EDEDED 0) top right;

		background-size: 52% 52%;
		background-repeat: no-repeat;
		border: solid 2px #EA5404;


	}

	.user-card {
		width: calc(100% - 30px);
		margin-top: 20rpx;
		height: 100px;
		margin-left: 15px;
		clip-path: polygon(15px 0, calc(100% - 15px) 0,

				100% 0px, 100% calc(100% - 15px),

				calc(100% - 15px) 100%, 0px 100%,

				0 calc(100% - 15px), 0 15px);

		background: linear-gradient(-45deg, #EDEDED 10px, #EDEDED 0) bottom right,

			linear-gradient(45deg, #EDEDED 0px, #EDEDED 0) bottom left,

			linear-gradient(135deg, #EDEDED 10px, #EDEDED 0) top left,

			linear-gradient(-135deg, #EDEDED 0px, #EDEDED 0) top right;

		background-size: 52% 52%;
		background-repeat: no-repeat;
		border: solid 2px #EDEDED;


	}

	.cover {
		width: 100%;
		height: 100px;
		background-image: url('@appstatic/car/car_series_bg.png');
		background-size: 100%, 100px;
		z-index: 2;
		display: flex;

	}

	.cover-unclick {
		width: 100%;
		height: 100px;
		background-image: url('@appstatic/car/car_series_bg_unclick.png');
		background-size: 100%, 100px;
		z-index: 2;
		display: flex;

	}

	.img {
		width: 150px;
		height: 100px;

		clip-path: polygon(15px 0px, 100% 0px,

				100% 0px, 100% 100%,

				100% 100%, 0px 100%,

				0 100%, 0 15px);

	}

	.info {
		width: calc(100% - 180px);
		height: 100px;
		display: flex;
		flex-direction: column;
		align-items: flex-end;
		justify-content: center;
		margin-right: 30px;
	}

	.type-clicked {

		/* width: 90px; */
		height: 32px;
		background: linear-gradient(135deg, transparent 10px, #EA5404 0) top left,
			linear-gradient(-90deg, transparent 0px, #EA5404 0) top right,
			linear-gradient(-45deg, transparent 10px, #EA5404 0) bottom right,
			linear-gradient(90deg, transparent 0px, #EA5404 0) bottom left;
		background-size: 52% 52%;
		background-repeat: no-repeat;
		color: #fff;
		text-align: right;
		padding: 5px;
		font-weight: 900;
		font-size: 16px;
		line-height: 24px;
		margin-bottom: 10px;

		padding-left: 15px;
		min-width: 75px;



	}

	.type {
		/* width: 90px; */
		height: 32px;
		background: linear-gradient(135deg, transparent 10px, #ADB0AE 0) top left,
			linear-gradient(-90deg, transparent 0px, #ADB0AE 0) top right,
			linear-gradient(-45deg, transparent 10px, #ADB0AE 0) bottom right,
			linear-gradient(90deg, transparent 0px, #ADB0AE 0) bottom left;
		background-size: 52% 52%;
		background-repeat: no-repeat;
		color: #fff;
		text-align: right;
		padding: 5px;
		font-weight: 900;
		font-size: 16px;
		line-height: 24px;
		margin-bottom: 10px;
		padding-left: 15px;
		min-width: 75px;
	}

	.price {
		font-style: normal;
		font-weight: 400;
		font-size: 14px;
		line-height: 18px;
		display: flex;
		align-items: center;
		color: #3D3A3A;
	}

	.before:before {
		content: " ";
		white-space: pre;

	}

	.img-box {
		width: 100vw;
		/* margin-left: calc(50% - 150rpx); */
		display: flex;
		flex-direction: column;
		align-items: center;
	}

	.emptyImage {
		width: 300rpx;
		height: 300rpx;
		margin-top: 50px;
	}

	.text {
		text-align: center;
		font-size: 28rpx;
		line-height: 5px;
		color: #ADB0AE;
	}
</style>
